
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package ac.uitls;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

/**
 *
 * @author ismail
 */
public class webapi {

    public static void data() throws MalformedURLException, IOException {
        URL yahoo = new URL("http://fiz.egzsport.com/api/test_mysql_setup.php");
        HttpURLConnection yc = (HttpURLConnection) yahoo.openConnection();
        
        yc.setDoOutput(true);
        String rawData = "query=SHOW COLUMNS FROM matahene_faiz";
        String type = "application/x-www-form-urlencoded";
        String encodedData = rawData;
        yc.setRequestMethod("POST");
       

        yc.setRequestProperty("Content-Type", type);
        yc.setRequestProperty("Content-Length", String.valueOf(encodedData.length()));
        OutputStream os = yc.getOutputStream();
        os.write(encodedData.getBytes());

        BufferedReader in = new BufferedReader(
                new InputStreamReader(
                        yc.getInputStream()));
        String inputLine;

        while ((inputLine = in.readLine()) != null) {
            System.out.println(inputLine + ">>>>");
        }
        in.close();
    }

}
